package com.wuyou.simple;

/**
 * 2351. 第一个出现两次的字母
 */
public class RepeatedCharacter {


    public static void main(String[] args) {
        String s = "eesll";
        System.out.println(solution_1(s));
    }

    public static char solution_1(String s){
        char[] c = s.toCharArray();
        byte[] b = new byte[26];
        char res = 'a';
        for(int i = 0; i < c.length; i ++){
            if(++b[c[i] - 'a'] >= 2) {
                res = c[i];
                break;
            }
        }
        return res;
    }
}
